// 命名空间
var majiang_yz = {};
// 所有代码
majiang_yz.subPath = 'modules/main/majiang_yz/';
majiang_yz.srcPath= majiang_yz.subPath + 'src/';
majiang_yz.src = [
    majiang_yz.srcPath + 'JiesuanLayer.js',
    majiang_yz.srcPath + 'JiesuanLayer_llfy.js',
    majiang_yz.srcPath + 'MaLayer.js',
    majiang_yz.srcPath + 'MaLayer_lnbj.js',
    majiang_yz.srcPath + 'TestMahjong.js',
    majiang_yz.srcPath + 'MaLayerLLFY.js',
    majiang_yz.srcPath + 'PlayBackLayer.js',
    majiang_yz.srcPath + 'QueMenLayer.js',
    majiang_yz.srcPath + 'ZongJiesuanLayer.js',
    majiang_yz.srcPath + 'HaidiLayer.js',
    majiang_yz.srcPath + 'ZhaniaoLayer.js',
    majiang_yz.srcPath + 'SubGameLayer.js',
    majiang_yz.srcPath + 'SubCreateRoomWindow.js',
    majiang_yz.srcPath + 'majiang_yz.js',
    majiang_yz.srcPath + 'BaijiaoLayer.js',
    majiang_yz.srcPath + 'JiesuanLayer_lnbj.js',
    majiang_yz.srcPath + 'MaHuTipLayer.js',
];

// 所有资源
majiang_yz.resPath= majiang_yz.subPath + 'res/';
var ccsMahjongBGPath = majiang_yz.resPath + 'backgrounds/';
var ccdMahjongEffectsPath = majiang_yz.resPath + 'effects/';
var ccsMahjongPiecesPath = majiang_yz.resPath + 'pieces/';
var ccsMahjongSkeletonsPath = majiang_yz.resPath + 'skeletons/';
var ccsMahjongSoundsPath = majiang_yz.resPath + 'sounds/';
var soundExt = '.mp3';
majiang_yz.res = {
    pai0plist: majiang_yz.resPath + 'pai.plist'
    , pai0_png: majiang_yz.resPath + 'pai.png'
    , ChiPanel_json : majiang_yz.resPath + 'ChiPanel.json'
    , DingPanel_json : majiang_yz.resPath + 'DingPanel.json'
    , HaidipaiLayer_json : majiang_yz.resPath + 'HaidipaiLayer.json'
    , JiesuanLayer_json : majiang_yz.resPath + 'JieSuan.json'
    , JiesuanLayerLLFY_json : majiang_yz.resPath + 'JieSuanLLFY.json'
    , JiesuanLayer_lnbj_json : majiang_yz.resPath + 'JieSuan_lnbj.json'
    , MaScene_json : majiang_yz.resPath + 'MaScene.json'
    , MaScene1_json : majiang_yz.resPath + 'MaScene1.json'
    , MaHuTipLayer_json : majiang_yz.resPath + 'HuTipLayer.json'
    , MaScene1LLFY_json : majiang_yz.resPath + 'MaScene1LLFY.json'
    , PlayBackLayer_json : majiang_yz.resPath + 'PlayBackLayer.json'
    , QueMenLayer_json : majiang_yz.resPath + 'QueMenLayer.json'
    , ThrowDice_json : majiang_yz.resPath + 'ThrowDice.json'
    , Zhaoniao_json : majiang_yz.resPath + 'Zhaniao.json'
    , BaijiaoLayer_json : majiang_yz.resPath + 'BaijiaoLayer.json'
    , ting_json : majiang_yz.resPath + 'TING.json'
    , liang_json : majiang_yz.resPath + 'liang.json'
    , zimo_json :  majiang_yz.resPath + 'ZIMO.json'
    , ZongJiesuanLayer_json : majiang_yz.resPath + 'ZongJieSuan.json'
    , CreateRoomWindow_json : majiang_yz.resPath + 'CreateRoomWindow.json'
    , TestMahjong_json: majiang_yz.resPath +'TestMahjong.json'

    , ZIMO_json:  majiang_yz.resPath + 'ZIMO.json'
    , TING_json:  majiang_yz.resPath + 'TING.json'
    , BAI_json : majiang_yz.resPath + "animation_hancheng/MJ_bai.json"

    // hupaitip_jiao_png: 'res/submodules/majiang/img/room/hupaitip_jiao.png'
    
    ,yingFnt:majiang_yz.resPath + 'ZongJieSuan/zjsha.fnt'
    ,shuFnt:majiang_yz.resPath + 'ZongJieSuan/zjsna.fnt'

    //碎图
    , lb_liang : ccsMahjongPiecesPath + 'lb_liang.png'
    , lb_lai : ccsMahjongPiecesPath + 'lb_lai.png'
    , signal1 : ccsMahjongPiecesPath + 'signal1_1.png'
    , signal2 : ccsMahjongPiecesPath + 'signal1_2.png'
    , signal3 : ccsMahjongPiecesPath + 'signal1_3.png'
    , signal4 : ccsMahjongPiecesPath + 'signal1_4.png'
    , signal5 : ccsMahjongPiecesPath + 'signal1_5.png'
    , xiapaozhongh : ccsMahjongPiecesPath + 'xiapaozhongh.png'
    , xiapaozhongv : ccsMahjongPiecesPath + 'xiapaozhongv.png'
    , yixiapaov : ccsMahjongPiecesPath + 'yixiapaov.png'
    , yixiapaoh : ccsMahjongPiecesPath + 'yixiapaoh.png'
    , xiaopao : ccsMahjongPiecesPath + 'xiaopao.png'
    , hupaitip_jiao1 : ccsMahjongPiecesPath + 'hupaitip_jiao1.png'
    , toast_bg_png : ccsMahjongPiecesPath + "toast_bg.png"
    , battery5 : ccsMahjongPiecesPath + 'battery5.png'
    , battery4 : ccsMahjongPiecesPath + 'battery4.png'
    , battery3 : ccsMahjongPiecesPath + 'battery3.png'
    , battery2 : ccsMahjongPiecesPath + 'battery2.png'
    , battery1 : ccsMahjongPiecesPath + 'battery1.png'
    , mjbg : ccsMahjongPiecesPath + 'mjbg.png'
    , sp1_0 : ccsMahjongPiecesPath + 'sp1_0.png'
    , sp1_1 : ccsMahjongPiecesPath + 'sp1_1.png'
    , sp1_2 : ccsMahjongPiecesPath + 'sp1_2.png'
    , sp1_3 : ccsMahjongPiecesPath + 'sp1_3.png'
    , sp1_4 : ccsMahjongPiecesPath + 'sp1_4.png'
    , sp1_5 : ccsMahjongPiecesPath + 'sp1_5.png'
    , sp1_6 : ccsMahjongPiecesPath + 'sp1_6.png'
    , touch0 : ccsMahjongPiecesPath + 'touch0.png'
    , touch1 : ccsMahjongPiecesPath + 'touch1.png'
    , sp_picback : ccsMahjongPiecesPath + 'sp_picback.png'
    , arrow : ccsMahjongPiecesPath + 'arrow.png'
    , hupaitip_hu : ccsMahjongPiecesPath + 'hupaitip_hu.png'
    , que1 : ccsMahjongPiecesPath + 'que1.png'
    , que2 : ccsMahjongPiecesPath + 'que2.png'
    , que3 : ccsMahjongPiecesPath + 'que3.png'
    , t0 : ccsMahjongPiecesPath + 't0.png'
    , t1 : ccsMahjongPiecesPath + 't1.png'
    , t2 : ccsMahjongPiecesPath + 't2.png'
    , t3 : ccsMahjongPiecesPath + 't3.png'
    , round_rect_157 : ccsMahjongPiecesPath + 'round_rect_157.png'
    , ting : ccsMahjongPiecesPath + 'ting.png'
    , narrow_0: ccsMahjongPiecesPath + 'narrow0.png'
    , narrow_1: ccsMahjongPiecesPath + 'narrow1.png'
    , narrow_2: ccsMahjongPiecesPath + 'narrow2.png'
    , narrow_3: ccsMahjongPiecesPath + 'narrow3.png'

    , btn_ting : majiang_yz.resPath + 'MaScene1/ting.png'

    //牌桌
    , table_back0 : ccsMahjongBGPath + 'table_back0.jpg'
    , table_back1 : ccsMahjongBGPath + 'table_back1.jpg'
    , table_back2 : ccsMahjongBGPath + 'table_back2.jpg'
    , table_back3 : ccsMahjongBGPath + 'table_back3.jpg'
    , table_back4 : ccsMahjongBGPath + 'table_back4.jpg'
    , table_back5 : ccsMahjongBGPath + 'table_back5.jpg'

    //sounds
    , vchi_1: ccsMahjongSoundsPath + 'man/chi' + soundExt
    , vpeng_1: ccsMahjongSoundsPath + 'man/peng' + soundExt
    , vgang_1: ccsMahjongSoundsPath + 'man/gang' + soundExt
    , vangang_1: ccsMahjongSoundsPath + 'man/angang' + soundExt
    , vhu_1: ccsMahjongSoundsPath + 'man/hu' + soundExt
    , vting_1: ccsMahjongSoundsPath + 'man/tingpai' + soundExt
    , vzimo_1: ccsMahjongSoundsPath + 'man/zimo' + soundExt
    , vchi_2: ccsMahjongSoundsPath + 'woman/chi' + soundExt
    , vpeng_2: ccsMahjongSoundsPath + 'woman/peng' + soundExt
    , vgang_2: ccsMahjongSoundsPath + 'woman/gang' + soundExt
    , vangang_2: ccsMahjongSoundsPath + 'woman/angang' + soundExt
    , vhu_2: ccsMahjongSoundsPath + 'woman/hu' + soundExt
    , vting_2: ccsMahjongSoundsPath + 'woman/tingpai' + soundExt
    , vzimo_2: ccsMahjongSoundsPath + 'woman/zimo' + soundExt
    , vbai_1 : ccsMahjongSoundsPath + 'man/bai' + soundExt
    , vbai_2 : ccsMahjongSoundsPath + 'woman/bai' + soundExt

    ,vbg_ma1: majiang_yz.resPath + 'bg_mp3/bgm_ma1.mp3'
    ,vbg_ma2: majiang_yz.resPath + 'bg_mp3/bgm_ma2.mp3'
    ,vbg_ma3: majiang_yz.resPath + 'bg_mp3/bgm_ma3.mp3'

    , vCardClick: ccsMahjongSoundsPath + 'common/audio_card_click' + soundExt
    , vCardOut: ccsMahjongSoundsPath + 'common/audio_card_out' + soundExt
    , vLose: ccsMahjongSoundsPath + 'common/audio_lose' + soundExt
    , vWin: ccsMahjongSoundsPath + 'common/audio_win' + soundExt

    //animation
    , ANGANG_json: majiang_yz.resPath + "animation_hancheng/MJ_angang.json"
    , MINGGANG_json: majiang_yz.resPath + "animation_hancheng/MJ_minggang.json"
    , HEIMO2_json: majiang_yz.resPath + "animation_hancheng/MJ_hupai_guang.json"
    , CHI_json: majiang_yz.resPath + "animation_hancheng/MJ_chi.json"
    , GANG_json: majiang_yz.resPath + "animation_hancheng/MJ_gang.json"
    , HU_json: majiang_yz.resPath + "animation_hancheng/MJ_hu.json"
    , PENG_json: majiang_yz.resPath + "animation_hancheng/MJ_peng.json"

    , bai_png : majiang_yz.resPath +"Baijiao/icon_bai.png"
    , bai_png_0 : majiang_yz.resPath +"Baijiao/icon_bai_0.png"
    , bai_png_1 : majiang_yz.resPath +"Baijiao/icon_bai_1.png"
    , bai_png_2 : majiang_yz.resPath +"Baijiao/icon_bai_2.png"
    , bai_png_3 : majiang_yz.resPath +"Baijiao/icon_bai_3.png"
    , jin_png : majiang_yz.resPath +"Baijiao/icon_jin.png"
    , shengyu_png : majiang_yz.resPath +"Baijiao/num.png"
    , shengyu_fnt : majiang_yz.resPath +"Baijiao/num.fnt"
    // , ting_png : majiang_yz.resPath +"MaScene/icon_jin.png"
};

//sounds
for (var i = 1; i <= 34; i++) {
    res['vp' + i + '_1'] = ccsMahjongSoundsPath + 'man/' + i + soundExt;
    res['vp' + i + '_2'] = ccsMahjongSoundsPath + 'woman/' + i + soundExt;
}

var getSortFlag = function () {
    var flag = -1;
    var sortFlag = cc.sys.localStorage.getItem('sortFlag');
    if (sortFlag) {
        flag = parseInt(sortFlag);
    }
    return flag;
};